<?php

// $Id$

require_once($WSC->get_site_inc_dir().'modules/admin_panel/site_admin_ajax_form_ctrl_with_object_ua.class.php');
require_once(TANGRA_MAIN_DIR.'web_site/web_page/just_headers_view.class.php');

require_once_from_inc('modules/admin_panel/forms/user/user_form_ctrl.class.php');


class User_Form_Ajax_Ctrl extends Site_Admin_Ajax_Form_Ctrl_With_Object_UA {
	protected function on_good_submit() {
		$redir = new Redirect_Composer_Local($this->get__context(), 'admin/user/users.php');
		$object = $this->form_ctrl->get_object();
//		$redir->add_param_pair('user', $object->get_id());
		$location = $redir->get_target_address($this->get__context());

		$ret = array('command' => Ajax_Ctrl::COMMAND_REDIRECT, 'command_value' => $location);

		return $ret;
	}


	protected function on_bad_submit() {
		return true;
	}


	protected function create_form_ctrl() {
		$tvm = $this->get_tvm();
		$dbc = $this->get_dbc();

		$ret = new User_Form_Ctrl('user', $tvm, $dbc);

		return $ret;
	}

}